package com.ionicframework.myapp619314;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import android.widget.Toast;


public class RotatoAdapter extends BaseAdapter {
    private LayoutInflater inflater;
	int[] resIds = { R.drawable.item_cheked, R.drawable.key_message_icon, R.drawable.list_load_failed, R.drawable.note_text_edit_v_to_t,
			R.drawable.pause_normal, R.drawable.red_dot, R.drawable.reminder_logo, R.drawable.workcenter_dynamic_custom,
			R.drawable.workcircle, R.drawable.yuyin_pressed };
	private Context context;
	private List<String> list;

	public RotatoAdapter(Context context, List<String> list) {
		this.context = context;
		this.list = list;
		inflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public String getItem(int position) {
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		return 0;
	}

	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {

		View view = inflater.inflate(R.layout.item_ring_menu, null);
		TextView textView1 = (TextView) view.findViewById(R.id.textView1);
		TextView textView2 = (TextView) view.findViewById(R.id.textView2);
		textView1.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				Toast.makeText(context, "点击了我,position=" + position, Toast.LENGTH_SHORT).show();
			}
		});
		textView1.setBackgroundResource(resIds[position]);
		textView2.setText(list.get(position));
		return view;
	}

}
